# include <bits/stdc++.h>
using namespace std;

int ans = 0, n, T;
bool vis[100];

void dfs(int x, int y) {
    if(x == n) { 
        ans ++;
        return;
    }
    for(int i = 1; i <= n; i++) { 
        if(i == y || vis[i] || (x == 1 && i == n) || (x == n && i == 1)) continue;
        vis[x] = 1;
        dfs(i, x);
        vis[x] = 0;
    }
}

int main() { 
    scanf("%d", &T);
    while(T--) { 
        ans = 0;
        scanf("%d", &n);
        for(int i = 2; i < n; i++) { 
            dfs(i, 1);
        }
        printf("%d\n", ans);
    }
}
